package com.dao.user;

import com.tools.ConfigManager;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;

public class BaseDao {
    public static Connection getConnection(){
        Connection connection = null;
        String driver =ConfigManager.getInstance().getValue("driver");
        String url =ConfigManager.getInstance().getValue("url");
        String user =ConfigManager.getInstance().getValue("user");
        String password =ConfigManager.getInstance().getValue("password");
        try{
            Class.forName(driver);
            connection = DriverManager.getConnection(url,user,password);
        }catch (Exception e){
            e.printStackTrace();
        }
        return connection;
    }

}
